let ajax = {
    post: (url, data, cb) => {
        let x = new XMLHttpRequest();
        x.open('POST', url)
        x.setRequestHeader('content-type', 'application/x-www-form-urlencoded')
        x.send(data)
        x.responseType = 'json';
        x.onreadystatechange = function () {
            if (x.readyState === 4) {
                if (x.status >= 200 && x.status < 300) {
                    // console.log(JSON.parse(x.response));
                    cb(x.response)
                }
            }
        }
    },
    get: (url, data, cb) => {
        let x = new XMLHttpRequest();
        x.open('get', url+'?'+data)
        x.send()
        x.responseType = 'json';
        x.onreadystatechange = function () {
            if (x.readyState === 4) {
                if (x.status >= 200 && x.status < 300) {
                    cb(x.response)
                }
            }
        }
    },
}